package com.example.demo.service.Impl;

import com.example.demo.mapper.LifebookMapper;
import com.example.demo.mapper.RoleMapper;
import com.example.demo.pojo.Module;
import com.example.demo.pojo.Role;
import com.example.demo.service.RoleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleMapper roleMapper;
    @Autowired
    LifebookMapper lifebookMapper;

    @Override
    public void add(Role role) {
        roleMapper.add(role);
    }

    @Override
    public PageInfo queryEnchanter(int page, int limit) {
        PageHelper.startPage(page,limit);
        List<Role> list=roleMapper.list();
        PageInfo<Role> rolePageInfo = new PageInfo<>(list);
        return rolePageInfo;
    }

    @Override
    public void update(Role role) {
        roleMapper.update(role);
    }

    @Override
    public boolean del(int id) {
        return roleMapper.del(id);
    }

    @Override
    public List<Module> getlevel(String idlist) {

        return roleMapper.module(idlist);
    }

    @Override
    public Role idlist(String role) {

        return roleMapper.idlist(role);
    }

    @Override
    public String getlevelAll() {
        return roleMapper.getlevelAll();
    }
}
